package com.example.sys.async.handler.impl;

import com.example.core.utils.SpringBeanUtils;
import com.example.sys.async.handler.ASyncHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;

public abstract class AbstractASyncHandlerImpl implements ASyncHandler  {

    private ApplicationContext applicationContext;

    public Environment environment;

    public ApplicationContext getApplicationContext() {
        if (this.applicationContext == null) {
            this.applicationContext = SpringBeanUtils.getApplicationContext();
        }
        return this.applicationContext;
    }

    public Environment getEnvironment() {
        if (this.environment == null) {
            this.environment = getApplicationContext().getEnvironment();
        }
        return this.environment;
    }
}
